<?php
/**
 * Created by PhpStorm.
 * User: CYJiao
 * Date: 6/10/15
 * Time: 10:19
 */

?>

<script>
    $(function(){
        $("#form-patient-information").form('load', {
            gender: '<?php echo $patientInformation['gender']; ?>',
            outpatient_cid: '<?php echo $patientInformation['outpatient_cid']; ?>',
            dob: '<?php echo $patientInformation['dob']; ?>',
            email: '<?php echo $patientInformation['email']; ?>',
            weight: '<?php echo $patientInformation['weight']; ?>',
            stature: '<?php echo $patientInformation['stature']; ?>',
            alcohol: '<?php echo $patientInformation['alcohol']; ?>',
            smoke: '<?php echo $patientInformation['smoke']; ?>',
            occupation: '<?php echo $patientInformation['occupation'] ?>',
            allergy: '<?php echo $patientInformation['allergy'] ?>'
        });
    });
  function save_patient(){

        $.ajax({
            type: 'POST',
            url: '<?php echo CController::createUrl('patient/savePatientInformation',array('pk_outpatient_id'=> $pk_outpatient_id)) ;?>',
            data: $('#form-patient-information').serialize(),
            success: function(data){
                if(data.status==0){
                    alert('保存成功！');
                }else{
                    alert('保存失败！');
                }
            },
            dataType: 'json'
        });
    }
</script>

<div class="easyui-layout" data-options="border:false" style="overflow: auto;">
    <form id="form-patient-information" method="post">
    <?php if($patientInformation['outpatient_file_url'] != ''):?>
        <img src="http://picserver.o2omedical.com:8080/o2o_pic_server<?php echo $patientInformation['outpatient_file_url'];?>normal/<?php echo $patientInformation["outpatient_file_id"]; ?><?php echo $patientInformation["outpatient_file_suffix"]; ?>?token=b226d434-052a-4a14-9c59-917173a12864" style="width:100%;" />
    <?php endif?>    
        <br />
        <div class="table-patient">
            <table style="width:100%;">
                <tbody>
                    <tr>
                        <th align="right">姓名：</th>
                        <td><?php echo $patientInformation['true_name'];?></td>
                    </tr>
                    <tr>
                        <th align="right">健康号：</th>
                        <td><?php echo $patientInformation['username'];?></td>
                    </tr>
                    <tr>
                        <th align="right">电话：</th>
                        <td><?php echo $patientInformation['phone'];?></td>
                    </tr>
                    <tr>
                        <th align="right">性别：</th>
                        <td>
                            <select id="gender" name="gender">
                                <option value="1" <?php if($patientInformation['gender']==1) echo 'selected';?>>男</option>
                                <option value="2" <?php if($patientInformation['gender']==2) echo 'selected';?>>女</option>
                                <option value="3" <?php if($patientInformation['gender']==3) echo 'selected';?>>保密</option>
                            </select>
                        </td>
                    </tr>
                    
                    <tr>
                        <th align="right">体重：</th>
                        <td><input type="text" class="easyui-textbox" style="width:50px;" name="weight" id="weight" />kg</td>
                    </tr>
                    <tr>
                        <th align="right">身高：</th>
                        <td><input type="text" class="easyui-textbox" style="width:50px;" name="stature" id="stature" />cm</td>
                    </tr>
                    <tr>
                        <th align="right">饮酒：</th>
                        <td>
                            <select class="" name="alcohol">
                                <option value="1" <?php if($patientInformation['alcohol']==1) echo 'selected';?>>无</option>
                                <option value="2" <?php if($patientInformation['alcohol']==2) echo 'selected';?>>很少</option>
                                <option value="3" <?php if($patientInformation['alcohol']==3) echo 'selected';?>>有时</option>
                                <option value="4" <?php if($patientInformation['alcohol']==4) echo 'selected';?>>经常</option>
                                <option value="5" <?php if($patientInformation['alcohol']==5) echo 'selected';?>>总是</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <th align="right">吸烟：</th>
                        <td>
                            <input class="easyui-textbox" style="width:50px;" name="smoke" value="<?php if($patientInformation['smoke']==NULL) echo '0'; else echo $patientInformation['smoke']; ?>"> 支/天
                        </td>
                    </tr>
                    <tr>
                        <th align="right">职业：</th>
                        <td><input type="text" class="easyui-textbox" style="width:60px;" name="occupation" id="occupation" /></td>
                    </tr>
                    <tr>
                        <th align="right">过敏史：</th>
                        <td><input type="text" class="easyui-textbox" style="width:60px;" name="allergy" id="allergy" /></td>
                    </tr>
                </tbody>
            </table>
        </div>
        <br />
        <a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-save'" onclick="save_patient();">保存</a>
    </form>
</div>